Production: Create Production Stack
We'll cover the following
Adding the prod stage#
Extracting the staging stack out of the main template was most of the work, so adding prod is going to be quite straightforward.
First, let’s add a deployment group so that our production hosts can be configured for deployment.
Line #8: We could have chosen to put the deployment groups in stage.yml
, but it is often useful to have different deployment configurations for different stages. For example, here we set the prod deployment to go on one host at a time, whereas the staging deployment was set to go all at once.
Next, we’ll add a new stage in our Pipeline
resource called Prod
at the end of the list.
Then we’ll add the new nested stack to main.yml
.
Line #3: Updates to the prod stack will not be enacted until the staging stack successfully applies stack updates.
Finally, we need to add an output in main.yml
to return the prod endpoint.
And now let’s deploy.
The staging endpoint should still be working when the deployment finishes, but our new production endpoint won’t be yet. This is because the deployment groups are configured so that the ASG will launch all new instances with the most recent revision deployed. But there will be no recent revision until the first proper deployment occurs. To fix this, we need to go to our pipeline and click Release Changes in order to get a deployment to prod. Once deployment finishes, then the prod hosts should start responding as well.
Let’s wrap this up by pushing these changes to our GitHub repository.
/
- deploy-infra.sh
In order to get a pictorial view of our developed cloudformation stack so far, below is the design view which shows the resources we created and their relationships.
In the next lesson, we will access our application from a custom domain.